﻿<?xml version="1.0" standalone="yes"?>
<SqlCommand>
	<xs:schema id="SqlCommand" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
		<xs:element name="SqlCommand" msdata:IsDataSet="true" msdata:Locale="hu-HU">
			<xs:complexType>
				<xs:choice maxOccurs="unbounded">
					<xs:element name="SqlCommand">
						<xs:complexType>
							<xs:sequence>
								<xs:element name="Type" type="xs:string" minOccurs="0" />
								<xs:element name="Version" type="xs:string" minOccurs="0" />
								<xs:element name="Select" type="xs:string" minOccurs="0" />
								<xs:element name="Where" type="xs:string" minOccurs="0" />
								<xs:element name="Order" type="xs:string" minOccurs="0" />
							</xs:sequence>
						</xs:complexType>
					</xs:element>
				</xs:choice>
			</xs:complexType>
		</xs:element>
	</xs:schema>
	<SqlCommand>
		<Type>Server</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT Server=@ProcSchema,
			Name=@Name,
			Collation=cast(serverproperty('Collation') as nvarchar(255)),
			Edition=cast(serverproperty('Edition') as nvarchar(255)),
			ProcuctVersion=cast(serverproperty('ProductVersion') as nvarchar(255)),
			ProductLevel=cast(serverproperty('ProductLevel') as nvarchar(255)),
			IsFullTextInstalled=cast(serverproperty('IsFullTextInstalled') as nvarchar(255)),
			IsIntegratedSecurityOnly=cast(serverproperty('IsIntegratedSecurityOnly') as nvarchar(255)),
			IsSingleUser=cast(serverproperty('IsSingleUser') as nvarchar(255)),
			IsSyncWithBackup=cast(serverproperty('IsSyncWithBackup') as nvarchar(255))
		</Select>
	</SqlCommand>

	<SqlCommand>
		<Type>Database</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT Server=@ProcSchema,
			Name=name,HasDbAccess=cast(IsNull(HAS_DBACCESS ([name]),0) as bit),
			IsAutoClose=cast(DatabasePropertyEx([name],'IsAutoClose') as bit),
			IsAutoCreateStatistics=cast(DatabasePropertyEx([name],'IsAutoCreateStatistics') as bit),
			IsAutoShrink=cast(DatabasePropertyEx([name],'IsAutoShrink') as bit),
			IsAutoUpdateStatistics=cast(DatabasePropertyEx([name],'IsAutoUpdateStatistics') as bit),
			IsAnsiNullDefault=cast(DatabasePropertyEx([name],'IsAnsiNullDefault') as bit),
			IsAnsiNullsEnabled=cast(DatabasePropertyEx([name],'IsAnsiNullsEnabled') as bit),
			IsAnsiPaddingEnabled=cast(DatabasePropertyEx([name],'IsAnsiPaddingEnabled') as bit),
			IsAnsiWarningsEnabled=cast(DatabasePropertyEx([name],'IsAnsiWarningsEnabled') as bit),
			IsArithmeticAbortEnabled=cast(DatabasePropertyEx([name],'IsArithmeticAbortEnabled') as bit),
			IsNullConcat=cast(DatabasePropertyEx([name],'IsNullConcat') as bit),
			IsNumericRoundAbortEnabled=cast(DatabasePropertyEx([name],'IsNumericRoundAbortEnabled') as bit),
			IsQuotedIdentifiersEnabled=cast(DatabasePropertyEx([name],'IsQuotedIdentifiersEnabled') as bit),
			IsRecursiveTriggersEnabled=cast(DatabasePropertyEx([name],'IsRecursiveTriggersEnabled') as bit),
			IsTornPageDetectionEnabled=cast(DatabasePropertyEx([name],'IsTornPageDetectionEnabled') as bit),
			IsCloseCursorsOnCommitEnabled=cast(DatabasePropertyEx([name],'IsCloseCursorsOnCommitEnabled') as bit),
			IsLocalCursorsDefault=cast(DatabasePropertyEx([name],'IsLocalCursorsDefault') as bit),
			Status=cast(DatabasePropertyEx([name],'Status') as nvarchar(200)),
			Updateability=cast(DatabasePropertyEx([name],'Updateability') as nvarchar(200)),
			Collation=cast(DatabasePropertyEx([name],'Collation') as nvarchar(200)),
			RecoveryOption=cast(DatabasePropertyEx([name],'Recovery') as nvarchar(200)),
			DatabaseVersion=cast(DatabasePropertyEx([name],'Version') as nvarchar(200)),
			DataBaseLevel=cast(cmptlevel as int),
			IsFulltextEnabled=cast(DatabasePropertyEx([name],'IsFulltextEnabled') as bit),
			IsInStandBy=cast(DatabasePropertyEx([name],'IsInStandBy') as bit),
			IsMergePublished=cast(DatabasePropertyEx([name],'IsMergePublished') as bit),
			IsSubscribed=cast(DatabasePropertyEx([name],'IsSubscribed') as bit),
			UserAccess=cast(DatabasePropertyEx([name],'UserAccess') as nvarchar(200))
			FROM master.dbo.sysdatabases
			WHERE name LIKE @Name
		</Select>
	</SqlCommand>
	<SqlCommand>
		<Type>User</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT Name=u.name,
			LoginName=l.loginname,
			DbName=l.dbname,
			IsSqlUser=Cast(u.issqluser as bit)
			FROM dbo.sysusers as u
			LEFT JOIN master.dbo.syslogins As l ON  u.sid =l.sid
			WHERE u.islogin = 1 and u.isaliased = 0 and u.hasdbaccess = 1
		</Select>
	</SqlCommand>
	<SqlCommand>
		<Type>UDT</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=u.name,
			Name=t.name,
			AllowNulls=cast(t.allownulls as bit),
			[Length]=cast(CASE WHEN t2.name IN (N'nchar', N'nvarchar') THEN t.length/2 ELSE t.length END as int),
			[Precision]=cast(isnull(t.prec,0) as int),
			[Scale]=cast(isnull(t.scale,0) as int),
			BaseType=IsNull(t2.name,''),
			DefaultSchema=IsNull(dusers.name,'') ,
			DefaultName=IsNull(def.name,''),
			RuleSchema=IsNull(rusers.name,''),
			RuleName=IsNull(rules.name,'')
			FROM dbo.systypes As t
			JOIN dbo.sysusers As u ON t.uid=u.uid
			JOIN dbo.systypes As t2 ON t.xtype=t2.xusertype
			LEFT JOIN dbo.sysobjects As def ON def.id=t.tdefault LEFT
			JOIN dbo.sysobjects As rules ON rules.id=t.domain
			LEFT JOIN dbo.sysusers As dusers  ON dusers.uid=def.uid
			LEFT JOIN dbo.sysusers As rusers  ON rusers.uid=rules.uid
			WHERE t.xusertype&gt;256 ORDER BY SchemaName,Name
		</Select>
	</SqlCommand>
	<SqlCommand>
		<Type>Table</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=user_name(o.uid),
			TableName=o.name,
			TableHasForeignKey=cast(objectproperty(o.id,'TableHasForeignKey') as bit),
			TableHasIndex=Cast(Case WHEN (SELECT COUNT(*) F
			FROM dbo.sysindexes As i
			WHERE i.id = o.id AND i.indid &gt; 0 and i.indid &lt; 255
			AND INDEXPROPERTY(i.id, i.name, N'IsStatistics') = 0
			AND INDEXPROPERTY(i.id, i.name, N'IsHypothetical') = 0
			AND i.name not in
			(select o2.name
			FROM dbo.sysobjects As o2 WHERE o2.parent_obj = o.id
			AND OBJECTPROPERTY(o2.id, N'isConstraint') = 1)) &gt; 0
			THEN 1 ELSE 0 END as bit) ,
			TableHasPrimaryKey=cast(ObjectProperty(o.id,'TableHasPrimaryKey') as bit),
			TableFileGroup=(SELECT TOP 1 FILEGROUP_NAME(groupid) FROM sysindexes As i WHERE i.id=o.id AND (i.indid=0 or i.indid=1)) ,
			TableTextInRowLimit=cast(ObjectProperty(o.id,'TableTextInRowLimit') as bit),
			TableHasUniqueCnst=cast(ObjectProperty(o.id,'TableHasUniqueCnst') as bit),
			TableHasCheckCnst=cast(ObjectProperty(o.id,'TableHasCheckCnst') as bit),
			TableIsPinned=cast(ObjectProperty(o.id,'TableIsPinned') as bit),
			TableFullTextBackgroundUpdateIndexOn=cast(ObjectProperty(o.id,'TableFullTextBackgroundUpdateIndexOn') as bit),
			TextFileGroup=cast(IsNull((SELECT TOP 1 FILEGROUP_NAME(groupid) FROM dbo.sysindexes As i WHERE i.indid=255 AND i.id = (SELECT i2.id FROM dbo.sysindexes As i2 WHERE i2.indid in (0,1) AND i2.id = o.id)),'')  as nvarchar(255))
			FROM dbo.sysobjects As o
			WHERE xtype=N'U' AND ObjectProperty(o.id,'IsMSShipped')=0
			AND o.name NOT LIKE '#%'
			AND user_name(o.uid) LIKE @ProcSchema
			#_AND o.name NOT LIKE '[_]%' _#
			AND o.name LIKE @Name
			ORDER BY SchemaName,TableName
		</Select>
	</SqlCommand>
	<SqlCommand>
		<Type>Fields</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=User_Name(ObjectProperty(c.id,'ownerid')),
			TableName=Object_Name(c.id),Name=c.name,
			ColId=c.colid,
			DataTypeName=st.name,
			BaseTypeName=bt.name,
			Length=case when bt.name in (N'nchar', N'nvarchar') then c.length/2 else c.length end,
			[Precision]=cast(CASE WHEN lower(bt.name) IN ('timestamp','nchar','nvarchar','varchar','char','binary','varbinary') THEN 0 ELSE isnull(c.prec,0) END as int),
			Scale=cast(isnull(c.scale,0) as int),
			AllowsNull=cast(isnull(c.isnullable,0) as bit),
			IsIdentity=cast(ColumnProperty(c.id, c.name, N'IsIdentity') as bit),
			IdentSeed=case when (ColumnProperty(c.id, c.name, N'IsIdentity') = 1) then
			CONVERT(nvarchar(40), ident_seed(User_Name(ObjectProperty(c.id,'ownerid'))+'.'+Object_Name(c.id))) else null end,
			IdentIncr=case when (ColumnProperty(c.id, c.name, N'IsIdentity') = 1) then
			CONVERT(nvarchar(40), ident_incr(User_Name(ObjectProperty(c.id,'ownerid'))+'.'+Object_Name(c.id))) else null end,
			ConstrSchema=case when (c.cdefault is not null and (ObjectProperty(c.cdefault, N'IsDefaultCnst') = 1)) then
			User_Name(OBJECTPROPERTY(c.cdefault,'ownerid')) else null end,
			ConstrName =case when (c.cdefault is not null and (ObjectProperty(c.cdefault, N'IsDefaultCnst') = 1)) then Object_Name(c.cdefault) else null end,
			ConstrNameIsGenerated=cast(CASE WHEN c.cdefault is not null and (ObjectProperty(c.cdefault, N'IsDefaultCnst') = 1) AND (SELECT o.status FROM dbo.sysobjects As o WHERE o.id=c.cdefault AND (o.status &amp; 64) = 0 ) &amp; 4 = 4 THEN 1 ELSE 0 END as bit) ,
			DefConstrSchema=case when (c.cdefault = 0) then null when (ObjectProperty(c.cdefault, N'IsDefaultCnst') = 1) then null else User_Name(d.uid) end,
			DefConstrName=case when (c.cdefault = 0) then null when (ObjectProperty(c.cdefault, N'IsDefaultCnst') = 1) then null else d.name end,
			IsComputed=cast(c.iscomputed as bit),
			ComputedText='',
			IsIdNotForRepl=cast(ColumnProperty(c.id, c.name, N'IsIdNotForRepl') as bit),
			IsFulltextIndexed=cast(ColumnProperty(c.id, c.name, N'IsFulltextIndexed') as bit),
			UsesAnsiTrim=cast(ColumnProperty(c.id, c.name, N'UsesAnsiTrim') as bit),
			RoleSchema=case when (c.domain = 0) then null else User_Name(r.uid) end,
			RoleName=case when (c.domain = 0) then null else r.name end,
			Collation=c.collation,
			IsIndexable=Cast(isnull(ColumnProperty(c.id, c.name, N'IsIndexable'),0) as bit) ,
			ColType=(select TOP 1 sc.name from dbo.syscolumns As sc join dbo.sysdepends As sd on sc.colid = sd.depnumber and sd.deptype = 1 and sc.id = c.id and sd.depid = c.id and ColumnProperty(sc.id, sc.[name], N'IsTypeForFullTexob') = 1) ,
			IsRowGuidCol=cast(ColumnProperty(c.id,c.name,N'IsRowGuidCol') as bit)
			FROM dbo.syscolumns As c
			LEFT JOIN dbo.sysobjects As d on d.id = c.cdefault
			LEFT JOIN dbo.sysobjects As r on r.id = c.domain
			JOIN dbo.systypes As st on st.xusertype = c.xusertype
			JOIN dbo.systypes As bt on bt.xusertype = c.xtype
			WHERE ObjectProperty(c.id,'IsUserTable')=1
			AND User_Name(ObjectProperty(c.id,'ownerid')) like @ProcSchema
			AND ObjectProperty(c.id,'IsMSShipped')=0
			#_AND Object_Name(c.id) NOT LIKE '[_]%'_#
			AND Object_Name(c.id) LIKE @Name
			ORDER BY SchemaName,TableName,ColId
		</Select>
	</SqlCommand>
	<SqlCommand>
		<Type>Index</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=User_Name(ObjectProperty(i.id,'ownerid')),
			TableName=object_name(i.id),
			Name=i.name ,
			IndexFillFactor=cast(i.OrigFillFactor as int),
			IsClustered=cast(indexproperty(i.id,i.name,'IsClustered') as bit),
			IsFullTextKey=cast(indexproperty(i.id,i.name,'IsFullTextKey') as bit),
			IsPadIndex=cast(indexproperty(i.id,i.name,'IsPadIndex') as bit),
			IsPageLockAllowed=cast(indexproperty(i.id,i.name,'IsPageLockDisallowed') as bit),
			IsRowLockAllowed=cast(indexproperty(i.id,i.name,'IsRowLockDisallowed') as bit),
			IndexFileGroup=FILEGROUP_NAME( groupid ),
			IdxCnstIsDisabled=IsNull(cast(ObjectProperty(Object_Id(User_Name(ObjectProperty(i.id,'ownerid'))+'.'+i.name),'CnstIsDisabled') as bit),0),
			IdxCnstIsNotTrusted=IsNull(cast(ObjectProperty(Object_Id(User_Name(ObjectProperty(i.id,'ownerid'))+'.'+i.name),'CnstIsNotTrusted') as bit),0),
			IsUnique=cast(indexproperty(i.id,i.name,'IsUnique') as bit)
			,IsPrimaryKey=cast(IsNull(ObjectProperty(Object_Id(User_Name(ObjectProperty(i.id,'ownerid'))+'.'+i.name),'IsPrimaryKey'),0) as bit),
			IsConstraint=cast(isnull(ObjectProperty(Object_Id(User_Name(ObjectProperty(i.id,'ownerid'))+'.'+i.name),N'IsConstraint'),0) as bit),
			NoRecompute=cast(CASE WHEN (i.status &amp; 0x1000000)=0 THEN 0 ELSE 1 END as bit),
			IgnoreDupKey=cast(CASE WHEN (i.status &amp; 0x1)=0 THEN 0 ELSE 1 END as int),
			IndId=i.indid,
			NoName= cast(CASE WHEN 	(SELECT o.status FROM dbo.sysobjects as o WHERE object_id(i.name)=o.id AND o.xtype in ('PK', 'UQ') AND (o.status &amp; 64) = 0) &amp; 4 = 4 			THEN 1 ELSE 0 END as bit),
			GeneratedName=''
			FROM dbo.sysindexes As i WHERE i.indid &gt; 0 and i.indid &lt; 255 	and (indexkey_property(i.id, i.indid, 1, N'isdescending') is not null) 	and (i.name is not null) AND 	(INDEXPROPERTY(i.id, i.name, N'IsStatistics') = 0) AND 	(INDEXPROPERTY(i.id, i.name, N'IsAutoStatistics') =0) AND 	(INDEXPROPERTY(i.id, i.name, N'IsHypothetical')  =0) AND 	(ObjectProperty(i.id,'IsUserTable')=1 OR ObjectProperty(i.id,'isView')=1)
			AND ObjectProperty(i.id,'IsMSShipped')=0
			#_AND object_name(i.id) NOT LIKE '[_]%' _#
			AND object_name(i.id) LIKE @Name
			AND User_Name(ObjectProperty(i.id,'ownerid')) LIKE @ProcSchema
			ORDER BY SchemaName,TableName,i.indid
		</Select>
	</SqlCommand>
	<SqlCommand>
		<Type>IndexKey</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=User_Name(ObjectProperty(i.id,'ownerid')),
			TableName=object_name(i.id),
			Name=i.name ,
			ColumnName=c.name,
			KeyNo=k.keyno,
			IsDescending=cast(indexkey_property(i.id, i.indid, k.keyno, N'isdescending') as bit),
			IndId=cast(i.indid as int) ,
			IsIncluded=cast(0 as bit) FROM dbo.sysindexes As i JOIN dbo.sysindexkeys As k ON i.id=k.id AND i.indid=k.indid JOIN dbo.syscolumns As c ON c.id=k.id AND k.colid=c.colid WHERE i.indid &gt; 0 and i.indid &lt; 255 	and (indexkey_property(i.id, i.indid, 1, N'isdescending') is not null)
			and (i.name is not null)
			AND (INDEXPROPERTY(i.id, i.name, N'IsStatistics') = 0)
			AND (INDEXPROPERTY(i.id, i.name, N'IsAutoStatistics') =0)
			AND (INDEXPROPERTY(i.id, i.name, N'IsHypothetical')  =0)
			AND (ObjectProperty(i.id,'IsUserTable')=1 OR ObjectProperty(i.id,'isView')=1)
			AND ObjectProperty(i.id,'IsMSShipped')=0
			#_AND object_name(c.id) NOT LIKE '[_]%' _#
			AND object_name(c.id) LIKE @Name
			AND User_Name(ObjectProperty(i.id,'ownerid')) LIKE @ProcSchema
			ORDER BY SchemaName,TableName,IndId,KeyNo
		</Select>
	</SqlCommand>
	<SqlCommand>
		<Type>Foreign</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT 	SchemaName=User_Name(ObjectProperty(r.constid,'ownerid')),
			TableName=Object_Name(fkeyid),
			Name=Object_Name(r.constid),
			RSchema=User_Name(ObjectProperty(rkeyid,'ownerid')),
			RTableName=Object_Name(rkeyid),
			FkeyCnstIsDisabled=cast(ObjectProperty(r.constid,'CnstIsDisabled') as bit),
			FkeyDeleteCascade = cast(isnull(ObjectProperty( r.constid, N'CnstIsDeleteCascade'),0) as bit),
			FkeyUpdateCascade = cast(isnull(ObjectProperty( r.constid, N'CnstIsUpdateCascade'),0) as bit),
			FkeyCnstIsColumn = cast(ObjectProperty( r.constid, N'CnstIsColumn') as bit),
			FkeyCnstIsNotTrusted=cast(ObjectProperty(r.constid,'CnstIsNotTrusted') as bit),
			FkeyCnstIsNotForReplication= cast(ObjectProperty( r.constid, N'CnstIsNotRepl') as bit),
			NoName= cast( CASE WHEN ((SELECT o.status FROM dbo.sysobjects as o WHERE r.constid=o.id AND	o.xtype='F' AND (o.status &amp; 64) = 0)) &amp; 4 = 4 	THEN 1 ELSE 0 END as bit) ,
			GeneratedName=''
			FROM dbo.sysreferences As r
			WHERE ObjectProperty(r.fkeyid,'IsUserTable')=1 AND ObjectProperty(r.fkeyid,'IsMSShipped')=0
			#_AND Object_Name(r.fkeyid) NOT LIKE '[_]%'_#
			AND Object_Name(r.fkeyid) LIKE @Name
			AND User_Name(ObjectProperty(r.constid,'ownerid')) LIKE @ProcSchema
			ORDER BY SchemaName,TableName,Name
		</Select>
	</SqlCommand>

	<SqlCommand>
		<Type>ForeignKey</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT 	SchemaName=User_Name(ObjectProperty(r.constid,'ownerid')),
			TableName=Object_Name(fkeyid),
			Name=Object_Name(r.constid),
			Fkey=(SELECT [name] from dbo.syscolumns where r.fkeyid=id and colid=r.fkey),
			Rkey=(SELECT [name] from dbo.syscolumns where r.rkeyid=id and colid=r.rkey),
			KeyNo=keyno
			FROM dbo.sysforeignkeys as r
			WHERE ObjectProperty(r.fkeyid,'IsUserTable')=1 AND ObjectProperty(r.fkeyid,'IsMSShipped')=0
			#_AND Object_Name(r.fkeyid) NOT LIKE '[_]%'_#
			AND Object_Name(r.fkeyid) LIKE @Name
			AND User_Name(ObjectProperty(r.constid,'ownerid')) LIKE @ProcSchema
			ORDER BY SchemaName,TableName,Name,KeyNo
		</Select>
	</SqlCommand>

	<SqlCommand>
		<Type>Check</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=User_Name(uid),
			TableName=Object_Name(parent_obj),Name=name,Id=c.id,
			NoName= cast(CASE WHEN (SELECT o.status
			FROM dbo.sysobjects as o
			WHERE c.id=o.id AND	o.xtype in ('C') AND (o.status &amp; 64) = 0) &amp; 4 = 4 	THEN 1 ELSE 0 END as bit),
			CnsIsDisabled=cast(isnull(ObjectProperty(c.id,'CnstIsDisabled'),0) as bit),
			CnsIsNotTrusted=cast(isnull(ObjectProperty(c.id,'CnstIsNotTrusted'),0) as bit),
			CnsNotForReplication=cast(isnull(ObjectProperty( c.id, N'CnstIsNotRepl'),0) as bit),
			UsesDatabaseCollation=0
			FROM dbo.sysobjects As c
			WHERE c.xtype='C' AND ObjectProperty(c.parent_obj,'IsUserTable')=1
			AND ObjectProperty(c.parent_obj,'IsMSShipped')=0
			#_AND Object_Name(c.parent_obj) NOT LIKE '[_]%'_#
			AND Object_Name(c.parent_obj) LIKE @Name
			AND User_Name(uid) LIKE @ProcSchema
			ORDER BY SchemaName,TableName,Id
		</Select>
	</SqlCommand>

	<SqlCommand>
		<Type>Function</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=User_Name(uid),
			Name=name ,
			IsQuotedIdentsOn=cast(IsNull(ObjectProperty(id,'IsQuotedIdentOn'),0) as bit) ,
			IsAnsiNullsOn=cast(IsNull(ObjectProperty(id,'IsAnsiNullsOn'),0) as bit) ,
			IsSchemaBound=cast(ObjectProperty(id,'IsSchemaBound') as bit)
			FROM dbo.sysobjects
			WHERE xtype IN ('TF','IF','FN')
			AND User_Name(uid) like @ProcSchema
			AND ObjectProperty(id,'IsMSShipped')=0
			#_AND name NOT LIKE '[_]%'_#
			AND name LIKE @Name
			ORDER BY SchemaName,Name
		</Select>
	</SqlCommand>
	<SqlCommand>
		<Type>Procedure</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=User_Name(uid),
			Name=name ,
			IsStartup=cast(ObjectProperty(id,'ExecIsStartup') as bit) ,
			IsQuotedIdentsOn=cast(IsNull(ObjectProperty(id,'IsQuotedIdentOn'),0) as bit) ,
			IsAnsiNullsOn=cast(IsNull(ObjectProperty(id,'IsAnsiNullsOn'),0) as bit)
			FROM dbo.sysobjects
			WHERE xtype='P'
			AND User_Name(uid) like @ProcSchema
			AND ObjectProperty(id,'IsMSShipped')=0
			#_AND name NOT LIKE '[_]%'  _#
			AND name LIKE @Name ORDER BY SchemaName,Name
		</Select>
	</SqlCommand>
	<SqlCommand>
		<Type>View</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=User_Name(uid),
			Name=name ,
			IsQuotedIdentsOn=cast(IsNull(ObjectProperty(id,'IsQuotedIdentOn'),0) as bit) ,
			IsAnsiNullsOn=cast(IsNull(ObjectProperty(id,'IsAnsiNullsOn'),0) as bit) ,
			IsSchemaBound=cast(IsNull(ObjectProperty(sysobjects.id, N'IsSchemaBound'),0) As bit)
			FROM dbo.sysobjects
			WHERE xtype='V'
			AND User_Name(uid) like @ProcSchema
			AND ObjectProperty(id,'IsMSShipped')=0
			#_AND name NOT LIKE '[_]%'  _#
			AND name LIKE @Name
			ORDER BY SchemaName,Name
		</Select>
	</SqlCommand>
	<SqlCommand>
		<Type>Trigger</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=User_Name(uid),Name=name,
			IsQuotedIdentsOn=cast(IsNull(ObjectProperty(id,'IsQuotedIdentOn'),0) as bit) ,
			IsAnsiNullsOn=cast(IsNull(ObjectProperty(id,'IsAnsiNullsOn'),0) as bit) ,
			IsFirstDeleteTrigger=cast(IsNull(ObjectProperty(id,'ExecIsFirstDeleteTrigger'),0) as bit) ,
			IsFirstInsertTrigger=cast(IsNull(ObjectProperty(id,'ExecIsFirstInsertTrigger'),0) as bit) ,
			IsFirstUpdateTrigger=cast(IsNull(ObjectProperty(id,'ExecIsFirstUpdateTrigger'),0) as bit) ,
			IsLastDeleteTrigger=cast(IsNull(ObjectProperty(id,'ExecIsLastDeleteTrigger'),0) as bit) ,
			IsLastInsertTrigger=cast(IsNull(ObjectProperty(id,'ExecIsLastInsertTrigger'),0) as bit) ,
			IsLastUpdateTrigger=cast(IsNull(ObjectProperty(id,'ExecIsLastUpdateTrigger'),0) as bit) ,
			TriggerIsDisabled=cast(IsNull(ObjectProperty(id,'ExecIsTriggerDisabled'),0) as bit) ,
			ExecIsDeleteTrigger=cast(IsNull(ObjectProperty(id,'ExecIsDeleteTrigger'),0) as bit) ,
			ExecIsInsertTrigger=cast(IsNull(ObjectProperty(id,'ExecIsInsertTrigger'),0) as bit) ,
			ExecIsUpdateTrigger=cast(IsNull(ObjectProperty(id,'ExecIsUpdateTrigger'),0) as bit)
			FROM dbo.sysobjects
			WHERE xtype='TR'
			AND User_Name(uid) like @ProcSchema
			AND ObjectProperty(id,'IsMSShipped')=0
			#_AND name NOT LIKE '[_]%'  _#
			AND name LIKE @Name
			ORDER BY SchemaName,Name
		</Select>
	</SqlCommand>

	<SqlCommand>
		<Type>Rule</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=User_Name(o.uid),
			Name=o.name
			FROM dbo.sysobjects o
			WHERE xtype='R'
			AND User_Name(o.uid) LIKE @ProcSchema
			order by SchemaName,Name
		</Select>
	</SqlCommand>

	<SqlCommand>
		<Type>Default</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT
			SchemaName=User_Name(o.uid),
			Name=o.name
			FROM dbo.sysobjects As o
			WHERE xtype='D'
			AND OBJECTPROPERTY(o.id, N'IsDefault') = 1
			AND User_Name(o.uid) LIKE @ProcSchema
			ORDER BY SchemaName,Name
		</Select>
	</SqlCommand>

	<SqlCommand>
		<Type>DefaultCnst</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT SchemaName=User_Name(o.uid),
			Name=o.name
			FROM dbo.sysobjects As o
			WHERE xtype='D'
			AND OBJECTPROPERTY(o.id, N'IsDefaultCnst') = 1
			AND User_Name(o.uid) LIKE @ProcSchema
			ORDER BY SchemaName,Name
		</Select>
	</SqlCommand>

	<SqlCommand>
		<Type>ComputedColumns</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT [Schema]=USER_NAME(o.uid),
			TableName=o.name,ColumnName=c.name,c.colid,co.text
			FROM dbo.sysobjects As o
			JOIN dbo.syscolumns As c on c.id=o.id
			JOIN dbo.syscomments As co on co.id=o.id AND co.number = c.colid
			WHERE c.iscomputed=1 AND o.xtype='U'
		</Select>
		<Order> ORDER BY [Schema],TableName,ColumnName,co.colid</Order>
	</SqlCommand>

	<SqlCommand>
		<Type>FileGroup</Type>
		<Version>Sql2000</Version>
		<Select>
			SELECT FileGroupName=groupname,
			IsReadOnly=FILEGROUPPROPERTY(groupname,'IsReadOnly')
			IsDefault=FILEGROUPPROPERTY(groupname,'IsDefault')
			FROM dbo.sysfilegroups
		</Select>
		<Order> ORDER BY FileGroupName</Order>
	</SqlCommand>

  <SqlCommand>
    <Type>Details</Type>
    <Version>Sql2000</Version>
    <Select>
      SELECT SchemaName=SCHEMA_NAME(o.uid),Name=OBJECT_NAME(m.id),
      ObjectType=0,
      Text = CASE cast(isnull(objectpropertyex(m.id,'IsEncrypted'),0) as bit) WHEN 0 then text ELSE '-- encrypted text' end
      FROM sys.syscomments AS m
      JOIN sys.sysobjects AS o ON o.id = m.id
      WHERE objectpropertyex(o.id,'IsMSShipped') = 0
    </Select>
  </SqlCommand>

</SqlCommand>